package jee.boot.module.quartz.task;

import jee.boot.common.utils.DateUtils;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.util.Date;

/**
 * 异步任务接口实现
 */
public class TaskDemo implements Job {


    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        JobDataMap dataMap = context.getMergedJobDataMap();
        long time=System.currentTimeMillis();
        System.out.println("(异步)开始:"+ DateUtils.formatDate(new Date(time),"yyyy-MM-dd HH:mm:ss"));
        try {
            Thread.sleep(1000*10);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("(异步)结束:"+DateUtils.formatDate(new Date(time),"yyyy-MM-dd HH:mm:ss"));
    }
}
